package com.fare.taluo.core.domain.config.line;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.transaction.annotation.Transactional;

import com.dayatang.domain.Entity;
import com.dayatang.domain.InstanceFactory;
import com.dayatang.domain.QuerySettings;
import com.fare.taluo.core.domain.BaseEntity;

@javax.persistence.Entity
@Table(name = "FDC_FLIGHTINFO_TEMP")
@SuppressWarnings("serial")
public class FeiChangZhunFlightInfoEntity extends BaseEntity<FeiChangZhunFlightInfoEntity> implements Entity{
	
	@Id
	@Column(name="ID", length=32)
	@GeneratedValue(generator="system-uuid")
	@org.hibernate.annotations.GenericGenerator(name="system-uuid", strategy="uuid")
	private String id;
	
	@Column(name = "FROMCITY")
	private String fromCity;
	@Column(name = "TOCITY")
	private String toCity;
	@Column(name = "FROMCITYNAME")
	private String fromCityName;
	@Column(name = "TOCITYNAME")
	private String toCityName;
	@Column(name = "FLIGHTNO")
	private String flightNo;

	@Column(name = "COMPANY_CODE")
	private String companyCode;
	@Column(name = "COMPANY_NAME")
	private String companyName;
	@Column(name="flight_start_time")//起飞时间
	private String flightStartTime;
	@Column(name="flight_end_time")
	private String flightEndTime;
	@Column(name="entry_time")
	private Date entryTime;//入库时间
	@Column(name="flight_date")
	private String flightDate;
	
	public String getFlightStartTime() {
		return flightStartTime;
	}
	public void setFlightStartTime(String flightStartTime) {
		this.flightStartTime = flightStartTime;
	}
	public String getCompanyCode() {
		return companyCode;
	}
	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}
	public String getCompanyName() {
		return companyName;
	}
	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getFromCity() {
		return fromCity;
	}
	public void setFromCity(String fromCity) {
		this.fromCity = fromCity;
	}
	public String getToCity() {
		return toCity;
	}
	public void setToCity(String toCity) {
		this.toCity = toCity;
	}
	public String getFromCityName() {
		return fromCityName;
	}
	public void setFromCityName(String fromCityName) {
		this.fromCityName = fromCityName;
	}
	public String getToCityName() {
		return toCityName;
	}
	public void setToCityName(String toCityName) {
		this.toCityName = toCityName;
	}
	public String getFlightNo() {
		return flightNo;
	}
	public void setFlightNo(String flightNo) {
		this.flightNo = flightNo;
	}
    
	public String getFlightEndTime() {
		return flightEndTime;
	}
	public void setFlightEndTime(String flightEndTime) {
		this.flightEndTime = flightEndTime;
	}
    

    

	public Date getEntryTime() {
		return entryTime;
	}
	public void setEntryTime(Date entryTime) {
		this.entryTime = entryTime;
	}
	public String getFlightDate() {
		return flightDate;
	}
	public void setFlightDate(String flightDate) {
		this.flightDate = flightDate;
	}
	protected FeiChangZhunFlightInfoEntityReposity getFeiChangZhunFlightInfoEntityReposity(){
		return InstanceFactory.getInstance(FeiChangZhunFlightInfoEntityReposity.class);
	}
    
	
	public void tranSave(FeiChangZhunFlightInfoEntity entity){
		getFeiChangZhunFlightInfoEntityReposity().tranSave(entity);
	}
	

	@Override
	public boolean isNew() {
		return getId() == null ;
	}

	@Override
	public boolean existed() {
		if (isNew()) {
			return false;
		}
		return getRepository().exists(getClass(), getId());
	}

	@Override
	public boolean notExisted() {
		return ! existed();
	}
	
	@Override
	public boolean existed(String propertyName, Object propertyValue) {
		List<?> entities = getRepository().find(QuerySettings.create(getClass()).eq(propertyName, propertyValue)); 
		return !(entities.isEmpty());
	}
	
}
